<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人信息</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
</head>
<body>
<div th:fragment="user_info">
    <h1>您尚未完善相关信息，无法使用系统功能</h1>
    <hr class="layui-bg-red">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>信息实名</legend>
    </fieldset>
    <form class="layui-form  layui-form-pane" action="" >
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username"  placeholder="请输入用户名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">真实姓名</label>
            <div class="layui-input-block">
                <input type="text" name="realname"  placeholder="请输入你的真实姓名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">学号</label>
            <div class="layui-input-block">
                <input type="text" name="studentid"  placeholder="请输入你的学号" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">学院</label>
            <div class="layui-input-block">
                <input type="text" name="college"  placeholder="请输入你的学院" class="layui-input">
            </div>
        </div>
        <div class="layui-upload">
            <label class="layui-form-label">头像:</label>
            <div class="layui-upload layui-input-block">
                <input type="hidden" name="userImage" value="${ui.userImage }" required lay-verify="required" />
                <button type="button" class="layui-btn layui-btn-primary" id="fileBtn"><i class="layui-icon">&#xe67c;</i>选择文件</button>
                <button type="button" class="layui-btn layui-btn-warm" id="uploadBtn">开始上传</button>
           </div>
        </div>
    </form>
        <script>
            layui.use(['form', 'layedit', 'laydate'], function () {
                var form = layui.form
                    , layer = layui.layer
                    , layedit = layui.layedit
                    , laydate = layui.laydate;

                var upload = layui.upload;
                upload.render({
                    elem: '#fileBtn',
                    url: '../updatePersonalById.do',
                    ext:'jpg|png|gif|bmp|jpeg',
                    accept: 'file',
                    auto: false,
                    bindAction: '#uploadBtn',
                    done: function(res){
                        alert(res.data.src);
                        $("[name=userImage]").val(res.data.src);
                    }
                });
                //创建一个编辑器
                var editIndex = layedit.build('LAY_demo_editor');
                //监听指定开关
                form.on('switch(switchTest)', function (data) {
                    layer.msg('开关checked：' + (this.checked ? 'true' : 'false'), {
                        offset: '6px'
                    });
                    layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
                });

            });
        </script>
</div>
</body>
</html>